﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace VehicleManagement.Models
{
    public class Approval
    {
        //   ----------申请审批表-----------
        //create table ApprovalInfo
        //(
        //ApproID int  IDENTITY(1,1) primary key,
        //ApplyID int not null,
        //Apply_state bit default(0),
        //DriverID INT not null ,
        //CarID INT not null,
        //reason varchar(100),
        //priority int ,
        //Remark  varchar(100),
        //foreign key (CarID) references CarInfo(CarID),
        //foreign key (ApplyID) references applyInfo(ApplyID),
        //foreign key (DriverID) references DriverInfo(DriverID)
        //)

        public int ApprovalID { get; set; }
        [DisplayName("申请表编号")]
        public int ApplyID { get; set; }

        [DisplayName("是否批准")]
        [Required(ErrorMessage = "申请状态不能为空")]
        public bool ApplyState { get; set; }

        [ScaffoldColumn(false)] 
        public int DriverID { get; set; }
        [ScaffoldColumn(false)] 
        public int CarID { get; set; }

        [DisplayName("车牌号码")]
        public virtual string CarNumber { get; set; }

        [DisplayName("司机姓名")]
        public virtual string DriverName { get; set; }

        [DisplayName("不通过原因")]
        [StringLength(100, ErrorMessage = "不通过原因不能超过100位")]
        public string Reason { get; set; }

        [DisplayName("优先级")]
        [Required(ErrorMessage = "优先级不能为空")]
        [Range(typeof(System.Int32), "0", "3", ErrorMessage = "优先级必须在0~3之间的整数")]
        public int Priority { get; set; }

        [DisplayName("备注")]
        [StringLength(100, ErrorMessage = "备注长度不能超过100位")]
        public string Remark { get; set; }

        public virtual Byte[] PathMap { get; set; }
        public virtual bool PathConfirm { get; set; }
        public virtual string Beginning { get; set; }
        public virtual string Destination { get; set; }
    }
}